<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>初始元素过度</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../../vue2.js"></script>
    <style>
        /* 进场动画: 随便名字-enter-active */
        .isShow-enter-active {
            animation: isShow 1s;
        }

        /* 出场动画 */
        .isShow-leave-active {
            animation: isShow 1s reverse;
        }

        @keyframes isShow {
            0% {
                opacity: 0;
                transform: translateX(-100px);
            }

            100% {
                opacity: 1;
                transform: translateX(0px);
            }
        }

    </style>
</head>
<body>
<div id="box">
    <button @click="isShow = !isShow">show</button>
    <transition enter-active-class="isShow-enter-active" leave-active-class="isShow-leave-active">
        <div v-show="isShow">11111111111111111</div>
    </transition>

    <!-- appear：页面初始时也有动画 -->
    <transition name="isShow" appear>
        <div v-show="isShow">2222222222222222</div>
    </transition>
</div>
<script>
    new Vue({
        el: "#box",
        data: {
            isShow: true,
        },
    })
</script>
</body>
</html>